#include <OgreMath.h>
#include <OgrePrerequisites.h>

#define DLL_EXPORT __declspec(dllexport)

using namespace Ogre;

extern "C" DLL_EXPORT Degree* getDegree(float d)
{
	return new Degree(d);
}

extern "C" DLL_EXPORT float call_Degree_valueRadians(Degree* d)
{
	return d->valueRadians();
}

extern "C" DLL_EXPORT float call_Degree_valueDegrees(Degree* d)
{
	return d->valueDegrees();
}

extern "C" DLL_EXPORT Degree* op_Degree_Unary(Degree* d, char op)
{
	switch(op)
	{
	case '+':
		return new Degree(+(*d));
	case '-':
		return new Degree(-(*d));
	default:
		return d;
	}
}

extern "C" DLL_EXPORT bool opBool_Degree_Binary_Degree(Degree* d, char* op, Degree* d2)
{
	unsigned int _op = op[1] ? op[0] + op[1] : op[0];
	switch(_op)
	{
	case '='+'=':
		return *d == *d2;
	case '<'+'=':
		return *d <= *d2;
	case '>':
		return *d > *d2;
	case '<':
		return *d < *d2;
	default:
		return false;
	}
}

extern "C" DLL_EXPORT Degree* opDegree_Degree_Binary_Degree(Degree* d, char* op, Degree* d2)
{
	unsigned int _op = op[1] ? op[0] + op[1] : op[0];

	switch(_op)
	{
	case '=':
		*d = *d2;
		return d;
	case '+'+'=':
		*d += *d2;
		return d;
	case '-'+'=':
		*d -= *d2;
		return d;
	default:
		return d;
	}
}

extern "C" DLL_EXPORT Degree* opDegree_Degree_Binary_Float(Degree* d, char* op, float fl)
{
	unsigned int _op = op[1] ? op[0] + op[1] : op[0];

	switch(_op)
	{
	case '*'+'=':
		*d *= fl;
		return d;
	case '/'+'=':
		*d /= fl;
		return d;
	default:
		return d;
	}
}